package com.persistence.dao;

import java.io.File;

import com.util.PropertiesManager;

public class DAOConfiguration {

	private static final String KEY_DATABASE = "db.schema.name";
	private static final String KEY_SERVER = "db.server.name";
	private static final String KEY_PORT = "db.port.number";
	private static final String KEY_USER = "db.user.name";
	private static final String KEY_PASSWORD = "db.password.name";
	private String database;
	private String server;
	private String port;
	private String user;
	private String password;
	private PropertiesManager dataProperties = null;

	public void load() {
		File currentDir = new File("");
		dataProperties = new PropertiesManager(currentDir.getAbsolutePath()
				+ "\\properties\\DevPropeties.properties");
		
		setDatabase(dataProperties.getValue(KEY_DATABASE));
		setServer(dataProperties.getValue(KEY_SERVER));
		setPort(dataProperties.getValue(KEY_PORT));
		setUser(dataProperties.getValue(KEY_USER));
		setPassword(dataProperties.getValue(KEY_PASSWORD));
	}

	// public void save() {
	// save("c:\\configDB.xml");
	// }
	//
	// public void save(String file) {
	// Properties properties = new Properties();
	// properties.setProperty(keyDriver, getDriver());
	// properties.setProperty(keyEngine, getEngine());
	// properties.setProperty(keyDatabase, getDatabase());
	// properties.setProperty(keyServer, getServer());
	// properties.setProperty(keyPort, getPort());
	// properties.setProperty(keyUser, getUser());
	// properties.setProperty(keyPassword, getPassword());
	// PropertiesUtil.loadProperties(file);
	// }

	public String getDatabase() {
		return database;
	}

	public void setDatabase(String database) {
		this.database = database;
	}

	public String getPort() {
		return port;
	}

	public void setPort(String port) {
		this.port = port;
	}

	public String getServer() {
		return server;
	}

	public void setServer(String server) {
		this.server = server;
	}

	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

}
